package com.maimao.order.client;

import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.enums.ExceptionEnum;
import com.maimao.core.exception.MaiMaoException;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.PageResult;
import com.maimao.core.model.resp.Result;
import com.maimao.model.goods.log.GoodsCheck;
import com.maimao.model.goods.log.GoodsCheckInput;
import com.maimao.model.order.es.EsOrder;
import com.maimao.model.order.input.OrderSearchInput;
import com.maimao.order.client.factory.EsFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@FeignClient(contextId = "esClient", value = ServiceContainer.SEARCH_SERVICE, fallbackFactory = EsFallBackFactory.class, configuration = FeignInterceptor.class)
public interface EsClient {

    @PostMapping("/order/saveBatch")
    Result saveBatch(@RequestBody List<EsOrder> orderList);

    /**
     * 分页条件查询订单 【目前只在订单服务——导出功能里调用】
     */
    @PostMapping("/order/list")
    Result<PageResult<EsOrder>> list(@RequestBody OrderSearchInput input, @RequestParam("page") Integer page, @RequestParam("size") Integer size);
}
